<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // exec()函数用于检索字符串中的正则表达式的匹配
    // 如果字符串中有匹配的值，则返回该匹配值，否则返回null

    var str = 'hello';
    var pattern = /o/;

    var strexec = pattern.exec(str);
    console.log(strexec); //输出结果为一个数组
</script>

</html>